/**
 * Copyright © 2016-2025 The Thingsboard Authors
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.terracloud.server.common.data.log;

import lombok.Getter;

/**
 * 日志类型枚举
 * 分为两大类：终端日志和平台日志
 */
@Getter
public enum LogType {
    
    // 终端日志类型
    /**
     * 告警日志 - 记录设备产生的告警信息
     */
    ALERT_LOG("告警日志", LogCategory.TERMINAL),
    
    /**
     * 处理日志 - 记录对设备告警或异常的处理过程
     */
    PROCESS_LOG("处理日志", LogCategory.TERMINAL),
    
    /**
     * 接收日志 - 记录设备上传的数据接收情况
     */
    RECEIVE_LOG("接收日志", LogCategory.TERMINAL),
    
    /**
     * 接收异常日志 - 记录设备数据接收过程中的异常情况
     */
    RECEIVE_EXCEPTION_LOG("接收异常日志", LogCategory.TERMINAL),
    
    // 平台日志类型
    /**
     * 异常日志 - 记录系统运行过程中的异常信息
     */
    EXCEPTION_LOG("异常日志", LogCategory.PLATFORM),
    
    /**
     * 业务日志 - 记录业务操作相关信息
     */
    BUSINESS_LOG("业务日志", LogCategory.PLATFORM),
    
    /**
     * 审计日志 - 记录需要审计的操作信息
     */
    AUDIT_LOG("审计日志", LogCategory.PLATFORM),
    
    /**
     * 操作日志 - 记录用户的操作行为
     */
    OPERATION_LOG("操作日志", LogCategory.PLATFORM);
    
    private final String description;
    private final LogCategory category;
    
    LogType(String description, LogCategory category) {
        this.description = description;
        this.category = category;
    }

    /**
     * 判断是否为终端日志类型
     * @return true-是终端日志，false-不是终端日志
     */
    public boolean isTerminalLog() {
        return category == LogCategory.TERMINAL;
    }
    
    /**
     * 判断是否为平台日志类型
     * @return true-是平台日志，false-不是平台日志
     */
    public boolean isPlatformLog() {
        return category == LogCategory.PLATFORM;
    }
}